package icu.ac.kr.phonebook;

import android.app.Activity;
import android.database.Cursor;
import android.os.Bundle;
import android.provider.ContactsContract;
import android.provider.ContactsContract.Data;
import android.provider.ContactsContract.CommonDataKinds.Phone;
import android.util.Log;

public class phonebook extends Activity {
    /** Called when the activity is first created. */
    
	public final String TAG = "PHONEBOOK";
	
	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
       // setContentView(R.layout.main);
 
 // data1(String)   data2(int)
 //   dongpil  		  1
 //    123     		  2

        
        Cursor c = getContentResolver().query(Data.CONTENT_URI, 
              new String[]{Phone.DATA1, Phone.DATA2}, 
                null, 
                null, null); 
        Log.d(TAG, "count : " + c.getCount());
        
        while(c.moveToNext())
        {
        	
        	if (c.getInt(c.getColumnIndex(Phone.DATA2)) == Phone.TYPE_MOBILE)
        		Log.d(TAG,Phone.TYPE+ "-------------" + c.getString(c.getColumnIndex(Phone.DATA1)));
        	
        }
        
    }
}